Linux field guide
Browse common commands for files, system information, users, networking, packages, processes, storage, text processing, archives, and shell scripting.
File & Directory Management
lsList files in a directory.
pwdShow the current working directory.
cd /pathChange to a directory.
mkdir newdirCreate a new directory.
rm file.txtDelete a file.
rm -r folderDelete a folder and its contents.
cp file1 file2Copy a file.
mv file1 file2Move or rename a file.
File Viewing & Editing
cat file.txtDisplay file contents.
less file.txtView a file one page at a time.
head file.txtShow the first 10 lines of a file.
tail file.txtShow the last 10 lines of a file.
nano file.txtEdit a file in Nano.
vim file.txtEdit a file in Vim.
System Information
uname -aShow system and kernel information.
whoamiShow the current username.
df -hShow disk usage in human-readable format.
du -sh folderShow the size of a folder.
free -hShow memory usage in human-readable format.
uptimeShow system uptime and load averages.
topMonitor processes in real time.
htopInteractive process monitoring.
User & Permissions
adduser mahekAdd a new user.
passwd mahekChange a user's password.
chmod 755 fileChange file permissions.
chown user fileChange file ownership.
groupsShow the groups the current user belongs to.
idShow user ID and group ID.
Networking
ping hostTest connectivity to a host.
curl urlFetch data from a URL.
wget urlDownload a file from the web.
ip addrShow IP addresses and interfaces.
ifconfigShow network interfaces; older command.
netstat -tulnShow listening TCP and UDP ports.
ss -tulnModern replacement for netstat to show listening ports.
ssh user@hostConnect to a remote host over SSH.
scp file user@host:/pathCopy a file to a remote host over SSH.
Package Management
Ubuntu and Debian package commands.
sudo apt updateUpdate package lists.
sudo apt upgradeUpgrade installed packages.
sudo apt install nmapInstall a package.
sudo apt remove pkgRemove a package.
dpkg -lList installed packages.
Process Management
ps auxShow running processes.
kill PIDStop a process by its ID.
killall nameStop processes by name.
jobsShow background jobs in the current shell.
fg %1Bring job 1 to the foreground.
bg %1Resume job 1 in the background.
Disk & Storage
mount /dev/sda1 /mntMount a disk partition.
umount /mntUnmount a mounted filesystem.
fdisk -lList disk partitions.
lsblkList block devices.
blkidShow block device attributes.
Search & Filters
find /path -name file.txtSearch for a file by name.
locate file.txtQuickly find files using the locate database.
grep "text" file.txtSearch for text inside a file.
egrep "pattern" file.txtSearch using extended regular expressions.
awk '{print $1}' file.txtProcess text by columns.
sed 's/old/new/g' file.txtReplace text in a file.
Archiving & Compression
tar -cvf archive.tar folderCreate a tar archive.
tar -xvf archive.tarExtract a tar archive.
gzip file.txtCompress a file with gzip.
gunzip file.txt.gzDecompress a gzip file.
zip archive.zip file.txtCreate a zip archive.
unzip archive.zipExtract a zip archive.
Shell & Scripting
echo "Hello World"Print text to the terminal.
historyShow command history.
alias ll='ls -la'Create a shortcut command.
bash script.shRun a Bash script.
sh script.shRun a shell script.
No matching commands found.